<?php
/**
 * Guard 权限检查
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/7/27
 * @copyright PanxSoft Inc.
 */
namespace App\Services\Utils;

trait GuardPermissionChecker
{
    use ApiChecker;

    /**
     * @param string|null $tip
     *
     * @throws \Exception
     */
    protected function checkGuardIsCustomerSuperAdmin(string $tip = null)
    {
        $this->checkIsTrue(Guard::isCustomerSuperAdmin(), $tip ?: trans('admin.is_super_man'));
    }

    /**
     * @param string|null $tip
     *
     * @throws \Exception
     */
    protected function checkGuardIsPanxSuperAdmin(string $tip = null)
    {
        $this->checkIsTrue(Guard::isPanxSuperAdmin(), $tip ?: trans('admin.is_super_man'));
    }

    /**
     * @param string|null $tip
     *
     * @throws \Exception
     */
    protected function checkGuardIsStoreSuperAdmin(string $tip = null)
    {
        $this->checkIsTrue(Guard::isStoreSuperAdmin(), $tip ?: trans('admin.is_super_man'));
    }
}